package com.game.linerunner;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class LineRunner extends Activity implements OnClickListener {
	
	private Button mmNewGame, mmSettings, mmHighScore,mmStore;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_line_runner);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.line_runner, menu);
		
		//locate location of buttons
		mmNewGame = (Button)findViewById(R.id.mainmenu_newGame);
        mmStore = (Button)findViewById(R.id.mainmenu_store);
        mmSettings = (Button)findViewById(R.id.mainmenu_settings);
        mmHighScore = (Button)findViewById(R.id.mainmenu_highScores);
        
        //add the listeners to buttons
		mmNewGame.setOnClickListener(this);
		mmStore.setOnClickListener(this);
		mmSettings.setOnClickListener(this);
		mmHighScore.setOnClickListener(this);
		
		return true;
	}
	
	//event handler for one click, launches the different activities and then closes the main menu one.
	 @Override
	    public void onClick(View v) {
	        switch(v.getId()){
	            case R.id.mainmenu_newGame:
	            	Intent newGameIntent = new Intent(this, NewGame.class);
	            	startActivity(newGameIntent);
	            	
	            	break;
	            case R.id.mainmenu_highScores:
	            	Intent highScoreIntent = new Intent(this, HighScore.class);
	            	startActivity(highScoreIntent);
	            	
	            	break;
	            case R.id.mainmenu_settings:
	            	Intent settingsIntent = new Intent(this, Settings.class);
	            	startActivity(settingsIntent);
	            	
	                break;
	            case R.id.mainmenu_store:
	            	Intent storeIntent = new Intent(this, InGameStore.class);
	            	startActivity(storeIntent);
	            	
	                break;
	        }
	    }

}
